package com.study.biz;

import java.util.List;

import com.study.bean.Users;
import com.study.dao.UsersDao;


public class UsersBiz {
	private UsersDao dao=new UsersDao(Users.class);
	private String register;
	
	public String getRegister() {
		return register;
	}

	public void setRegister(String register) {
		this.register = register;
	}
	//查询用户数量
	public int usercount(){
		return dao.usercount();
	}

	public UsersBiz() {
		//瀹炰緥鍖杁ao绫�
		dao = new UsersDao(Users.class);
	}
	//鐢ㄦ埛鐧婚檰
		public Users adminLogin(String phone,String pwd) {
			List<Users> list = dao.selectByphoneAndPwd(phone, pwd);
			if(list!=null && list.size()>0) {
				for (Users u : list) {
					if(u.getUpwd().equals(pwd)) {
						return u;
					}
				}
			}
			return null;
		}
	
	public Users selectphone(String phone) {
		return dao.selectphone(phone);
	}
	//娉ㄥ唽鐢ㄦ埛
	public int register(Users use) throws Exception  {
		return dao.doInsertusers(use);
	}
	
	public Users selects(int uid){
		return dao.selects(uid);
	}
	
	//鏍规嵁鐢ㄦ埛id鏌ヨ鐢ㄦ埛瀵嗙爜
	public  List<Users> looks(Integer uid){
		return dao.looks(uid);
	}
	//淇敼鐢ㄦ埛淇℃伅
	public int doupdate(Users user){
		return dao.doupdates(user);
		
	}
	//鏂板鐢ㄦ埛
	public int add(Users use) throws Exception  {
		return dao.doupdates(use);
	}
	
	
}